# copies files from build into a zip file for distribution
# list of files to go into dir, names dir file with date and time
$fileList = @("README.*", "Web", "sqlscripts", "ATGI.CS.Facebook\bin\Debug\*")
$zipFileName = "ATGi.CS.Facebook-$([DateTime]::Now.ToString('MMddyy-HHmm'))"

# First transform the README to HTML
[void][Reflection.Assembly]::LoadFile((resolve-path "lib\anrControls.Markdown.NET.dll").Path)
$md = new-object anrControls.Markdown
$readmeHTML = $md.Transform([string]::join([environment]::newline, (get-content -path README.md)))
@"
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en' dir='ltr'>
    <head>
        <title>Facebook Connect in Telligent Community Server</title>
        <style type='text/css'>
            body {
                font-family: Verdana, Arial, sans-serif;
                font-size: 0.9em;
                color: #333;
                width: 900px;
                margin: 10px auto;
                background-color:#aaa;
            }
            h1, h2, h3, h4, h5, h6 { font-family: Georgia, Times, Times New Roman; }
            code {
                font-size: 1.0em;
                color: #555;
            }
            li { padding: 7px 0px; }
            ul li { list-style-type: square; }
            #container { 
                border: solid 2px #000;
                padding: 0 15px;
                background-color: #fff;
            }
        </style>
    </head>
    <body>
        <div id='container'>
        $readmeHTML
        </div>
    </body>
</html>
"@ | out-file -encoding UTF8 README.html


# create the output directory and copy the items in.
new-item -path . -name $zipFileName -itemType directory
$fileList | % { copy-item $_ $zipFileName -recurse}
get-childitem -path $zipFileName -recurse -include ".svn"  | % { remove-item $_ -force -recurse }